#version 460


layout(binding = 0) uniform Ubo {
    mat4 model;
    mat4 view;
    mat4 proj;
    mat4 prevModel;
    mat4 prevView;
    mat4 prevProj;
    mat4 baseProj;
    vec4 cameraPosition;
    vec4 lightPosition;
    vec4 lightColor;
    vec4 lightData;
} ubo;


layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inNormal;
layout(location = 2) in vec3 inTangent;
layout(location = 3) in vec3 inBitangent;
layout(location = 4) in vec2 inUV;


layout(location = 0) out vec3 outPosition;
layout(location = 1) out vec3 outNormal;
layout(location = 2) out vec3 outTangent;
layout(location = 3) out vec3 outBitangent;
layout(location = 4) out vec2 outUV;
layout(location = 5) out vec4 currScreenPosition;
layout(location = 6) out vec4 prevScreenPosition;


void main() {
    gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0);
    outPosition = vec3(ubo.model * vec4(inPosition, 1.0));
    outNormal = mat3(ubo.model) * inNormal;
    outTangent = mat3(ubo.model) * inTangent;
    outBitangent = mat3(ubo.model) * inBitangent;
    outUV = inUV;

    currScreenPosition = ubo.baseProj * ubo.view * ubo.model * vec4(inPosition, 1.0);
    prevScreenPosition = ubo.prevProj * ubo.prevView * ubo.prevModel * vec4(inPosition, 1.0);
}
